<template>
	<view>
		<view style="display: flex; align-items: center; justify-content: center; flex-direction: column;">
			<image src="../../static/logo.png" style="width: 250rpx; height: 250rpx; margin-top: 100rpx;"></image>
			<view style="margin-top: 50rpx;">
				<view
					style="display: flex; align-items: center; padding-left: 30rpx; border-radius: 50rpx; box-shadow: 5rpx 5rpx 5rpx 5rpx #f5f5f5; width: 500rpx; height: 80rpx;">
					<image src="../../static/user_icon.png" style="width: 45rpx; height: 50rpx;"></image>
					<view style="width: 1rpx; height: 50rpx; background-color: #666; margin-left: 20rpx;"></view>
					<u--input style="margin-left: 10rpx; margin-right: 30rpx;" placeholder="请输入账号" border="none"
						:clearable="true" v-model="zh"></u--input>
				</view>
				<view
					style="display: flex; margin-top: 50rpx; align-items: center; padding-left: 30rpx; border-radius: 50rpx; box-shadow: 5rpx 5rpx 5rpx 5rpx #f5f5f5; width: 500rpx; height: 80rpx;">
					<image src="../../static/password_icon.png" style="width: 45rpx; height: 50rpx;"></image>
					<view style="width: 1rpx; height: 50rpx; background-color: #666; margin-left: 20rpx;"></view>
					<u--input v-if="mmxszt==0" style="margin-left: 10rpx; margin-right: 20rpx;" placeholder="请输入密码" border="none" 
						password type="text" v-model="mm" @change="mmsr"></u--input>
					<u--input  v-else style="margin-left: 10rpx; margin-right: 20rpx;" placeholder="请输入密码" border="none" 
						 type="text" v-model="mmm" @change="mmmsr"></u--input>
					<image v-if="mmxszt==0" @click="qhmmxszt(0)" src="../../static/show_psw_press.png"
						style="width: 40rpx; height: 25rpx; margin-right: 30rpx;"></image>
					<image v-else @click="qhmmxszt(1)" src="../../static/show_psw.png"
						style="width: 40rpx; height: 25rpx; margin-right: 30rpx;"></image>
				</view>
				
				<view style="width: 520rpx; margin-top: 40rpx; color: rgb(60, 135, 252); display: flex; align-items: center; justify-content: space-between;">
					<p @click="tzzc">注册</p>
					<p @click="tzwj">忘记</p>
				</view>
				
			</view>
		</view>
		<view style="position: absolute; bottom: -10rpx;">
			<image src="../../static/login_back.png" style="width: 1200rpx; height: 400rpx;"></image>
		</view>

		<up-button @click="dl" color="#3C87FC"
			style="width: 530rpx;  border-radius: 50rpx; height: 80rpx; margin-top: 30rpx; box-shadow: 5rpx 5rpx 5rpx 5rpx #f5f5f5; font-size: 30rpx;">登录</up-button>
	</view>
</template>

<script>
	import api from "../../common/api.js"
	export default {
		data() {
			return {
				zh: "ry",
				mm: "123123",
				mmm: "123123",
				mmxszt: 0
			}
		},
		methods: {
			tzzc(){
				uni.navigateTo({
					url: 'zczh',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			tzwj(){
				uni.navigateTo({
					url: 'wjmm',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},
			qhmmxszt(a) {
				if (a == 0) {
					this.mmxszt = 1
				} else {
					this.mmxszt = 0
				}
			},
			mmsr(a) {
				this.mmm = a
			},
			mmmsr(a) {
				this.mmm = a
			},
			dl() {
				uni.showToast({
					icon:"loading",
					title: '登录中...'
				});
				api.get("/moblie/login", "POST", {
					"username": this.zh,
					"password": this.mm
				}).then(s => {
					console.log(s);
					if (s.code == "200") {
						uni.showToast({
							title: '登录成功'
						});
					} else {
						uni.showToast({
							icon:"error",
							title: s.msg
						});
					}

				})
			}
		}
	}
</script>

<style>

</style>